package charles.testproject.interandouterclass;

public class InerClassTest {

	public InerClassTest(){
		InnerClass innCon = new InnerClass();
		innCon.showInfo();
	}//when the constructor was called,there already got a enclosing instance of type of InerClassTest
	
	public static void main(String[] args) {
//		InnerClass i = new InnerClass();//no enclosing instance of type InerClassTest,must qualify the allocation
										//with an enclosing instance of type InerClassTest
//		InnerClass i = new InerClassTest().new InnerClass();//the right way to new a InnerClass
		
		InerClassTest t = new InerClassTest();
		t.methodToNewClass();
		

	}
	
	private void methodToNewClass(){
		InnerClass inn = new InnerClass();
		inn.showInfo();
	}//when this method was called ,there already got a enclosing instance of type of InerClassTest
	
	private class InnerClass{
		void showInfo(){
			System.out.println("Inner class....");
		}
	}
    
	private void methodToNewClassAnotherWay(){
		InerClassTest.InnerClass i3 = new InerClassTest.InnerClass();
		i3.showInfo();
	}
	
	
}
